from time import sleep
from selenium import webdriver

class BasePage1:
    def __init__(self,driver=None):
        if driver:
            self.driver=driver
        else:
            self.driver=webdriver.Chrome()
            self.driver.implicitly_wait(5)
            self.driver.maximize_window()

    def converter(self,target):
        id,value=target.split(",")
        return id.strip(),value.strip()

    def locate_element(self,target):
        id, value=self.converter(target)
        return  self.driver.find_element(id, value)

    def input(self,target,kayvalue):
        self.locate_element( target).send_keys(kayvalue)

    def open(self,url,timeout=5):
        self.driver.get(url)

    def get_text(self,target):
        return self.locate_element( target).text

    def get_attribute(self,target,param):
        return self.locate_element(target).get_attribute(param)

    def quit(self):
        self.driver.quit()

    def wait(self,seconds):
        sleep(seconds)